from threading import Condition, Thread


#from model.components.MemoryManager import MemoryManager
#from model.components.Pcb import Pcb
class Kernel(Thread):
    def __init__(self, memoria, cola):
        Thread.__init__(self)
        self.wait_condition = Condition()
        #self.memoryManager = MemoryManager(memoria)
        self.pid = 0
        self.cola = cola
        
    def tick(self):
        with self.wait_condition:
            self.wait_condition.notify()
        
    def run(self):
        while(True):
            print("corriendo un ciclo")
            #si hay interrupcion manejarlas
            #si el cpu esta libre cargar el siguiente pcb
            with self.wait_condition:
                self.wait_condition.wait()
            
    def execute(self, program, hardDisk, prioridad):
        programa = hardDisk.getPrograma(program)
        #block = self.memoryManager.guardarEnMemoria(programa)
        #pcb = Pcb (prioridad, block.inicio, self.pid)
        #self.cola.agregarPCB(pcb)